using UnityEngine;
using System.Collections;

public class PlayerWalkState : State<PlayerControl>
{
    #region Singleton

    private static PlayerWalkState instance = new PlayerWalkState();
    public static PlayerWalkState Instance { get { return instance; } }
    private PlayerWalkState() { }

    #endregion
    
    #region State

    public override void OnEnter(PlayerControl behaviour)
    {
        behaviour.playerPrefab.animation.CrossFade(AnimationConstants.PLAYER_ROLL_START);
        behaviour.audio.clip = behaviour.rollSound;        
      //  behaviour.audio.Play();
    }

    public override void OnUpdate(PlayerControl behaviour)
    {
        behaviour.playerPrefab.animation.CrossFade(AnimationConstants.PLAYER_ROLL_COMPLETE);
        behaviour.Move(behaviour.directionToMove, behaviour.walkSpeed);     
    }

    public override void OnExit(PlayerControl behaviour)
    {
        behaviour.audio.Stop();
    }

    public override void OnAction(string name, PlayerControl behaviour, object value)
    {
    }

    #endregion
}
